@extends('app')

@section('content')
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="tabbable" id="tabs-876069">
                <ul class="nav nav-tabs">
                    <li class="active">
                        <a href="#panel-656128" data-toggle="tab">评论列表</a>
                    </li>
                    <li>
                        <a href="#panel-952476" data-toggle="tab">搜索</a>
                    </li>
                </ul>
                <div class="tab-content">
                    <!--列表开始-->
                    <div class="tab-pane active" id="panel-656128">
                        <h5 class="sub-header"></h5>
                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th><input id="checkAll" type="checkbox" value=""></th>
                                    <th>公司</th>
                                    <th>职位</th>
                                    <th>评论内容</th>
                                    <th>回复数</th>
                                    <th>评论人</th>
                                    <th>发布时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($comments as $res)
                                <tr id="news_{{ $res->comment_id }}">
                                    <td><input type="checkbox" name="comments" value="{{ $res->comment_id }}"></td>
                                    <td><a href="{{ url('/company/detail?typeid=2&comid='.$res->company_id)}} "> @if(!empty($res->company->name)){{ str_limit($res->company->name,20) }} @else 公司已删除 @endif</a></td>
                                    @if($res->job_id > 0)
                                    <td><a href="{{ url('/company/detail?typeid=1&jobsid='.$res->job_id)}} "> @if(!empty($res->jobs->title)){{ str_limit($res->jobs->title,20) }} @else 职位已删除 @endif</a></td>
                                    @else
                                    <td>无</td>
                                    @endif
                                    <td><a href="javascript:void(0)"  onclick="showComment('{{$res->content}}')">{{ str_limit($res->content,20)}}</a></td>
                                    <td>{{ $res->childComments->count()}}</td>
                                    <td>{{getUserName($res->user_id)}}</td>
                                    <td>{{ $res->created_at }}</td>
                                    <td>
                                        <a href="javascript:void(0);" onclick="del_one('/admin/enterprise/comment/delete','{{$res->comment_id}}','{{ csrf_token() }}','comment_id')"><i class="glyphicon glyphicon-remove-sign"></i></a>
                                    </td>
                                </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                        <div>
                            <a class="btn btn-danger" onclick="batch_del('/admin/enterprise/comment/deletes','{{ csrf_token() }}', 'comment_id', 'comments'); ">
                                <i class="icon-trash icon-large"></i>
                                删除
                            </a>
                        </div>
                        <div>{!! $comments->render() !!} </div>
                    </div>
                    <!--列表结束-->

                    <!--搜索开始-->
                    <div class="tab-pane " id="panel-952476">
                        <div style="width: 95%;margin: auto;padding-top: 40px;">
                            <div style="width: 50%;float: left;">
                                <form class="form-horizontal" action="/admin/enterprise/comments" method="get">
                                    <div class="form-group">
                                        <label for="inputEmail3" class="col-sm-2 control-label">关键词:</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="keywords" class="form-control" id="inputEmail3" placeholder="输入关键词">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="inputPassword3" class="col-sm-2 control-label">作者:</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="author" class="form-control" id="inputPassword3" placeholder="">
                                        </div>
                                    </div>
                                    {!! csrf_field() !!}
                                    <div class="form-group">
                                        <div class="col-sm-offset-2 col-sm-10">
                                            <button type="submit" class="btn btn-primary">搜索</button>
                                        </div>
                                    </div>
                                </form>
                            </div>

                        </div>
                    </div>
                    <!--搜索结束-->
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        /*复选框样式*/
        $('input').iCheck({
            checkboxClass: 'icheckbox_flat-blue',
            radioClass: 'iradio_flat-blue',
            increaseArea: '-10' // optional
        });

        /*全选*/
        $('#checkAll').on('ifClicked', function(event){
            $('input[name="comments"]').iCheck('check');
        });
    });
</script>
@endsection


















